<html>
	
	<head>
		<meta charset="utf-8" />
		<title>修改商品信息</title>
	</head>

	<body>
		
		<a href="{:U('goods_list')}">商品列表</a>
		<form>
			<input type="hidden" value="{$info['id']}" id="goods_id" />
			<label>
				名称：
				<input type="text" name="goods_name" id="goods_name" value={$info['goods_name']} />
			</label>
			<br/>
			<label>
				描述：
				<input type="text" name="goods_desc" id="goods_desc" value={$info['goods_desc']} />
			</label>

<!-- 			<label>
				图片：
				<input type="file" name="goods_img" id="goods_img" />
			</label>
 -->
			<br/>
			<label>
				详情：
				<input type="text" name="goods_detail" id="goods_detail" value={$info['goods_detail']} />
			</label>
			<br/>
			<label>
				价格：
				<input type="text" name="goods_price" id="goods_price" value={$info['goods_price']} />
			</label>
			<br/>
			<label>
				库存：
				<input type="text" name="goods_num" id="goods_num" value={$info['goods_num']} />
			</label>
	
			 <div style="width:100px;height:30px;background:#ccc;margin:30px;text-align:center;line-height:30px;" id="update_info">修改</div>
		</form>

	</body>

</html>
<script type="text/javascript" src="__PUBLIC__/js/jquery-2.1.0.js"></script>

<script type="text/javascript">
	

	$('#update_info').on('click',function(){

		//收集数据	
		var data = {
			id:$("#goods_id").val(),
			goods_name:$("#goods_name").val(),
			goods_desc:$("#goods_desc").val(),
			goods_detail:$("#goods_detail").val(),
			goods_price:$("#goods_price").val(),
			goods_num:$("#goods_num").val()
		};

		//TODO:验证数据
		
		//使用ajax提交数据
		//
		var url = '{:U("update_info")}';


		$.post(url,data,function(result){

			//console.log(typeof(result));

			if(result.status == 1){
				alert(result.msg);
				window.location.href = '{:U('goods_list')}';
			}
			else{
				alert(result.msg);
			}

		});




	});



</script>




